/*********************************************
*		
*		File Name : WiredInterFrame.java
*		Author    : HuangYao
*		Email     : huangyaobyte@gmail.com
*		Date      : Feb 8, 2014
*		
*********************************************/
/*
*    
*/



package nsg2.swing;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JToolBar;

import nsg2.param.SwitchMode;

/**
 * @author huangyao
 *有线网络图形化制作界面
 */
public class WiredInterFrame extends JInternalFrame{
	private JDesktopPane jdp;
	JToolBar toolbar = new JToolBar();
	JButton bNode = new JButton("NODE");
	JButton bLink = new JButton("LINK");
	JButton bAgent = new JButton("Agent");
	JButton bApplication = new JButton("Application");
	JButton bParameters = new JButton("Parameters");
	JButton bTCL = new JButton("TCL");
	SceneVirtualizer sv = new SceneVirtualizer();
	public WiredInterFrame(String title){
		super(title,true,true,true,true);
		this.setSize(400, 300);
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		
		createMenu();
		getContentPane().add(this.sv,"Center");
		this.setVisible(true);
	}
	public WiredInterFrame(JDesktopPane jdp,String title){
		super(title,true,true,true,true);
		this.jdp = jdp;
		this.setSize(jdp.getWidth(), jdp.getHeight());
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		this.setVisible(true);
	}
	
	private void createMenu(){
		bNode.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				sv.switchMod(SwitchMode.NODE);
			}
			
		});
		bLink.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				sv.switchMod(SwitchMode.LINK);
			}
			
		});
		bAgent.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				sv.switchMod(SwitchMode.AGENT);
			}
			
		});
		bApplication.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				sv.switchMod(SwitchMode.APP);
			}
			
		});
		
		
		this.toolbar.add(bNode);
		this.toolbar.add(bLink);
		this.toolbar.add(bAgent);
		this.toolbar.add(bApplication);
		this.toolbar.add(bParameters);
		this.toolbar.add(bTCL);
		getContentPane().add(this.toolbar, "North");
	}
}
